package com.guli.product.controller;

import com.guli.common.response.PageResult;
import com.guli.common.response.Result;
import com.guli.model.product.Brand;
import com.guli.product.service.BrandService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("/product/brand")
public class BrandController {
    @Autowired
    BrandService brandService;

    //分页列表
    @PostMapping("/findPage/{page}/{size}")
    public PageResult<Brand> findPage(
            @PathVariable Integer page,
            @PathVariable Integer size,
            @RequestBody Map searchMap
    ){
        return brandService.findPage(page,size,searchMap);
    }
    //商品添加 修改
    @PostMapping("/save")
    public Result save(@RequestBody Brand brand){
        return brandService.save(brand);
    }

    //商品删除 id
    @GetMapping("/deleteById")
    public Result  deleteById(@RequestParam Long id){
        return  brandService.deleteById(id);
    }
    //查询 id
    @GetMapping("/selectById")
    public Brand selectById(@RequestParam Long id){
        return  brandService.selectById(id);
    }

}
